<script>
/**
 * 城市数据
 * @Author Mumu xinglinhe@qq.com
 * @Date 2022/09/13
 */
export default{
	components:{},
	props:{},
	data(){
		return {
			field:[
			{
				title: '#',
				width:'30px',
				customRender: ({index}) => index+1
			}, {
				title: '城市',
				dataIndex: 'cityName',
				align:'center'
			}, {
				title: '体验门店数量',
				dataIndex: 'desc',
			}, {
				title: '销售金额',
				dataIndex: 'sort',
			}],//表头
			list:[],//列表
			pagination: {
				defaultCurrent: 1,
				current: 1,
				defaultPageSize: 10,
				pageSize: 10,
				showQuickJumper: true,
				showSizeChanger: true,
				showTotal: (total, range) => `共${total}条`,
				total: 0,
			},
			listloading:false,
			search:{},
		}
	},
	created(){},
	mounted() {
		this.$nextTick(()=>{
			this.getList();
		})
	},
	methods:{
		async getList() {
			if(this.listloading) return;
			this.listloading		=	true;
			let rs	=	await this.muajax.brandList({
				...this.search,
				page:this.pagination.current,
				size:this.pagination.pageSize,
			});
			this.listloading		=	false;
			// if (rs.status!=200) return;
			if ( this.pagination.current == 1 ){
				this.records		=	[];
			}
			this.list=rs.data;
			this.pagination.total=rs.sum;
		},//列表
		research(){
			this.pagination.current=1;
			this.getList();
		},//搜索重置
		applysDataTableChangeHandle(pagination, filters, sorter) {
			this.pagination.current		= pagination.current;
			this.pagination.pageSize	= pagination.pageSize;
			this.getList();
		},//操作分页控制
	},
	computed:{},
	watch:{},
	filters:{},
}
</script>
<template>
	<a-card>
		<a-form layout="inline" class="text-center mm-b-20">
			<a-form-item label="搜索">
				<a-input
					v-model:value="search.keyword"
					placeholder="请输入城市名"
					style="width:300px"
				/>
			</a-form-item>
			<a-form-item>
				<a-space>
					<a-button type="primary" @click="research()">搜索</a-button>
					<!-- <a-button type="default">重置</a-button> -->
				</a-space>
			</a-form-item>
		</a-form>


		<a-table
			:columns="field"
			:data-source="list"
			:pagination="pagination"
			:loading="listloading"
			:scrollToFirstRowOnChange="true"
			@change="page=>applysDataTableChangeHandle(page)"
			size="small"
			:row-key="(record)=>JSON.stringify(record)"
		>
		</a-table>
	</a-card>
</template>
<style lang="less" scoped>

</style>